<template>
  <div>
    <el-dialog title="资料" v-model="visible" width="960px">
      <el-form ref="formRef" :model="formData" label-position="right" label-width="0px">
        <el-form-item prop="material">
          <el-input type="textarea" rows="24" v-model="formData.material"/>
        </el-form-item>
      </el-form>
      <template #footer>
          <span class="dialog-footer">
            <el-button type="info" @click="close">取 消</el-button>
            <el-button type="primary" @click="saveInfo">保 存</el-button>
          </span>
      </template>

    </el-dialog>
  </div>
</template>

<script lang="ts" setup>
const visible = ref(false)
const formRef = ref()
const formData = ref({})

import request from '@/config/axios'

const emit = defineEmits(["ok"])

const close = function () {
  visible.value = false
}

const orderInfo = ref({})
const saveInfo = function () {
  request.post({
    url: '/negotiation/updateById',
    data: formData.value
  }).then(res => {
    visible.value = false
    ElMessage.success('保存成功')
  })
}

const fetchData = async function () {
  const response = await request.get({
    url: '/negotiation/getById',
    params: { "id": formData.value.id }
  })
  formData.value = response
}


defineExpose({
  open: (rowData) => {
    visible.value = true;
    formData.value = rowData
    fetchData()
  }
})
</script>


<style scoped>

</style>
